<template >
  <span>{{Label}}</span>
</template>

<script  type="text/ecmascript-6">
  import * as exampleApi from 'api/example'
  export default {
    name: 'posts',
    props: {
      value: {
        type: String,
        default: ''
      },
      type: {
        type: String,
        default: ''
      },
      orgId: {
        type: String,
        default: ''
      }
    },
    data() {
      return {
        Label: ''
      }
    },
    mounted() {
      this.init()
    },
    methods: {
      init() {
        if (this.orgId) {
          exampleApi.modePost('/api/public/sys/orgDict/list', {
            orgId: this.orgId,
            type: this.type
          }).then(
            res => {
              if (res.data.data) {
                res.data.data.forEach(tmp => {
                  if (tmp.value === this.value) {
                    this.Label = tmp.label
                  }
                })
              }
            }
          )
        } else {
          exampleApi.modePost('/api/public/sys/dict/list', {
            type: this.type
          }).then(
            res => {
              if (res.data.data) {
                res.data.data.forEach(tmp => {
                  if (tmp.value === this.value) {
                    this.Label = tmp.label
                  }
                })
              }
            }
          )
        }
      }
    }
  }
</script>

<style scoped lang="less"></style>
